<div bsModal #actionModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="actionModal"
  aria-hidden="true" [config]="{backdrop: 'static'}">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <form *ngIf="active" #editForm="ngForm" novalidate>
        <div class="modal-header">
          <h4 class="modal-title"><span>选择文件</span></h4>
          <button type="button" class="close" (click)="close()" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>

        <div class="modal-body">
          <div class="row align-items-center m--margin-bottom-10">
            <div class="col-xl-12">
              <div class="form-group m-form__group align-items-center">
                <div class="input-group">
                  <input [(ngModel)]="filterText" name="filterText" autofocus class="form-control m-input"
                    [placeholder]="l('SearchWithThreeDot')" type="text" />
                  <span class="input-group-btn">
                    <button (click)="search()" class="btn btn-primary" type="submit">
                      <i class="flaticon-search-1" [attr.aria-label]="l('Search')"></i>
                    </button>
                  </span>
                </div>
              </div>
            </div>
          </div>
          <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
            <tabset class="tab-container tabbable-line">
              <tab customClass="m-tabs__item">
                <span *tabHeading>
                  有效文件 &nbsp;<span class='m-badge m-badge--success'>
                    {{primengTableHelper.totalRecordsCount}}
                  </span>
                </span>
                <p-table #dataTable (onLazyLoad)="getModels($event)" [value]="primengTableHelper.records"
                  rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false" [lazy]="true"
                  emptyMessage="没有数据" scrollable="true" [(selection)]="selectedpick" dataKey="id" ScrollWidth="100%"
                  responsive="primengTableHelper.isResponsive" resizableColumns="primengTableHelper.resizableColumns"
                  [globalFilterFields]="[]">

                  <ng-template pTemplate="header">
                    <tr>
                      <th style="width: 20px">
                        <p-tableHeaderCheckbox></p-tableHeaderCheckbox>
                      </th>
                      <th style="width: 60px" pSortableColumn="FileName">
                        文件名称
                        <p-sortIcon field="FileName"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="TechFileInfoType">
                        文件类型
                        <p-sortIcon field="TechFileInfoType"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="StageType">
                        阶段
                        <p-sortIcon field="StageType"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="SecurityType">
                        密级
                        <p-sortIcon field="SecurityType"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="ModelName">
                        型号
                        <p-sortIcon field="ModelName"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="DrawingCode">
                        图号
                        <p-sortIcon field="DrawingCode"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="ParagraphNo">
                        部段号
                        <p-sortIcon field="ParagraphNo"></p-sortIcon>
                      </th>
                      <th style="width: 60px">
                        更改单号
                      </th>
                    </tr>
                  </ng-template>
                  <ng-template pTemplate="body" let-record="$implicit" let-expanded="expanded">
                    <tr>
                      <td style="width: 20px">
                        <p-tableCheckbox [value]="record"></p-tableCheckbox>
                      </td>
                      <td style="width: 60px">{{ record.fileName }}</td>
                      <td style="width: 60px">
                        {{ record.techFileInfoTypeName}}
                      </td>
                      <td style="width: 60px">
                        {{ record.stage}}
                      </td>
                      <td style="width: 60px">
                        {{ record.security}}
                      </td>
                      <td style="width: 60px">{{ record.modelName }}</td>
                      <td style="width: 60px">{{ record.drawingCode }}</td>
                      <td style="width: 60px">{{ record.paragraphNo }}</td>
                      <td style="width: 60px">{{ record.alterationInvoiceCode }}</td>
                  </ng-template>
                </p-table>
                <div class="primeng-paging-container">
                  <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                    (onPageChange)="getModels($event)" [totalRecords]="primengTableHelper.totalRecordsCount"
                    [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
                  </p-paginator>
                  <span class="total-records-count"> {{ '总计:' + primengTableHelper.totalRecordsCount }} </span>
                </div>
              </tab>

              <tab customClass="m-tabs__item">
                <span *tabHeading>
                  无效文件 &nbsp;<span class='m-badge m-badge--danger'>
                    {{primengTableHelper1.totalRecordsCount}}
                  </span>
                </span>
                <p-table #dataTable1 (onLazyLoad)="getModels1($event)" [value]="primengTableHelper1.records"
                  rows="{{primengTableHelper1.defaultRecordsCountPerPage}}" [paginator]="false" [lazy]="true"
                  emptyMessage="没有数据" scrollable="true" [(selection)]="selectedpick" dataKey="id" ScrollWidth="100%"
                  responsive="primengTableHelper1.isResponsive" resizableColumns="primengTableHelper1.resizableColumns"
                  [globalFilterFields]="[]">

                  <ng-template pTemplate="header">
                    <tr>
                      <th style="width: 60px" pSortableColumn="FileName">
                        文件名称
                        <p-sortIcon field="FileName"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="TechFileInfoType">
                        文件类型
                        <p-sortIcon field="TechFileInfoType"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="StageType">
                        阶段
                        <p-sortIcon field="StageType"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="SecurityType">
                        密级
                        <p-sortIcon field="SecurityType"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="ModelName">
                        型号
                        <p-sortIcon field="ModelName"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="DrawingCode">
                        图号
                        <p-sortIcon field="DrawingCode"></p-sortIcon>
                      </th>
                      <th style="width: 60px" pSortableColumn="ParagraphNo">
                        部段号
                        <p-sortIcon field="ParagraphNo"></p-sortIcon>
                      </th>
                      <th style="width: 60px">
                        更改单号
                      </th>
                    </tr>
                  </ng-template>
                  <ng-template pTemplate="body" let-record="$implicit" let-expanded="expanded">
                    <tr>
                      <td style="width: 60px">{{ record.fileName }}</td>
                      <td style="width: 60px">
                        {{ record.techFileInfoTypeName}}
                      </td>
                      <td style="width: 60px">
                        {{ record.stage}}
                      </td>
                      <td style="width: 60px">
                        {{ record.security}}
                      </td>
                      <td style="width: 60px">{{ record.modelName }}</td>
                      <td style="width: 60px">{{ record.drawingCode }}</td>
                      <td style="width: 60px">{{ record.paragraphNo }}</td>
                      <td style="width: 60px">{{ record.alterationInvoiceCode }}</td>
                  </ng-template>
                </p-table>
                <div class="primeng-paging-container">
                  <p-paginator [rows]="primengTableHelper1.defaultRecordsCountPerPage" #paginator1
                    (onPageChange)="getModels1($event)" [totalRecords]="primengTableHelper1.totalRecordsCount"
                    [rowsPerPageOptions]="primengTableHelper1.predefinedRecordsCountPerPage">
                  </p-paginator>
                  <span class="total-records-count"> {{ '总计:' + primengTableHelper1.totalRecordsCount }} </span>
                </div>
              </tab>
            </tabset>
          </div>
        </div>

        <div class="modal-footer">
          <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">{{ l('Cancel') }}</button>
          <button type="button" class="btn btn-primary blue" [disabled]="!(editForm.form.valid)" (click)="save()">
            <i class="fa fa-check-circle"></i> <span>确定</span>
          </button>
        </div>
      </form>
    </div>
  </div>
</div>
